﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace 窗口依附测试
{
    public partial class FrmD : Form
    {
        public FrmD()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 显示窗口到Panel控件上
        /// </summary>
        /// <param name="frmSon"></param>
        /// <param name="panel"></param>
        private void ShowWindows2Panel(Form frmSon, Panel panel)
        {
            frmSon.TopLevel = false;
            frmSon.Parent = panel;
            frmSon.WindowState = FormWindowState.Maximized;
            frmSon.FormBorderStyle = FormBorderStyle.None;
            frmSon.Show();
        }

        /// <summary>
        /// 显示窗口到Panel控件上
        /// </summary>
        /// <param name="frmSon"></param>
        /// <param name="panel"></param>
        private void ShowWindows2TabPage(Form frmSon, TabPage tabPage)
        {
            frmSon.TopLevel = false;
            frmSon.Parent = tabPage;
            frmSon.WindowState = FormWindowState.Maximized;
            frmSon.FormBorderStyle = FormBorderStyle.None;
            frmSon.Show();
        }

        private void FrmD_Shown(object sender, EventArgs e)
        {
            ShowWindows2Panel(new FrmE(), panel1);
            ShowWindows2Panel(new FrmG(), panel1);
            ShowWindows2TabPage(new FrmF(), tabPage1);
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            timer1.Enabled = false;
            
        }
    }
}
